﻿using System;
using UnityEngine;

namespace H
{
	// Token: 0x0200026D RID: 621
	public abstract class H_State_TrembleBase : H_State
	{
		// Token: 0x0600104A RID: 4170 RVA: 0x000683E8 File Offset: 0x000665E8
		public H_State_TrembleBase(H_Members members) : base(members)
		{
		}

		// Token: 0x0600104B RID: 4171
		protected abstract string GetAnimeName_Base();

		// Token: 0x0600104C RID: 4172
		protected abstract string GetAnimeName_TrembleA();

		// Token: 0x0600104D RID: 4173
		protected abstract string GetAnimeName_TrembleB();

		// Token: 0x0600104E RID: 4174
		protected abstract H_STATE GetNextState();

		// Token: 0x0600104F RID: 4175 RVA: 0x000683F4 File Offset: 0x000665F4
		protected string GetAnimeName_Tremble(H_State_TrembleBase.TREMBLE tremble)
		{
			return (tremble != H_State_TrembleBase.TREMBLE.A) ? this.GetAnimeName_TrembleB() : this.GetAnimeName_TrembleA();
		}

		// Token: 0x06001050 RID: 4176 RVA: 0x00068410 File Offset: 0x00066610
		public override void In(H_State.Message msg)
		{
			this.trembleCount = 0;
			this.TrembleAnime(true);
		}

		// Token: 0x06001051 RID: 4177 RVA: 0x00068420 File Offset: 0x00066620
		public override void Main()
		{
			this.next_timer -= Time.deltaTime;
			if (this.next_timer <= 0f)
			{
				this.TrembleAnime(false);
			}
			if (this.members.StyleData.type == H_StyleData.TYPE.SERVICE)
			{
				if (this.trembleCount >= 5)
				{
					base.ChangeState(this.GetNextState(), null);
				}
			}
			else if (this.members.CheckEndVoice())
			{
				base.ChangeState(this.GetNextState(), null);
			}
		}

		// Token: 0x06001052 RID: 4178 RVA: 0x000684A8 File Offset: 0x000666A8
		public override void Out()
		{
		}

		// Token: 0x06001053 RID: 4179 RVA: 0x000684AC File Offset: 0x000666AC
		protected void TrembleAnime(bool isFirst)
		{
			H_State_TrembleBase.TREMBLE tremble;
			if (isFirst)
			{
				tremble = (H_State_TrembleBase.TREMBLE)UnityEngine.Random.Range(0, 2);
			}
			else
			{
				int num = (int)(this.lastTremble + 1);
				int num2 = 2;
				tremble = (H_State_TrembleBase.TREMBLE)(num % num2);
			}
			this.members.PlayAnime(this.GetAnimeName_Tremble(tremble), 0.2f);
			this.lastTremble = tremble;
			this.next_timer = (float)this.trembleCount * 0.5f;
			this.trembleCount++;
			GlobalData.Debug_Log("ビクッ");
		}

		// Token: 0x04001181 RID: 4481
		protected float next_timer;

		// Token: 0x04001182 RID: 4482
		protected H_State_TrembleBase.TREMBLE lastTremble;

		// Token: 0x04001183 RID: 4483
		protected bool nowTrembling;

		// Token: 0x04001184 RID: 4484
		protected int trembleCount;

		// Token: 0x0200026E RID: 622
		protected enum TREMBLE
		{
			// Token: 0x04001186 RID: 4486
			A,
			// Token: 0x04001187 RID: 4487
			B,
			// Token: 0x04001188 RID: 4488
			NUM
		}
	}
}
